package com.aqie.rabbit.bean.api.message;

import com.aqie.rabbit.bean.db.Message;
import com.google.gson.annotations.Expose;

import javax.validation.constraints.*;

/*
{
    "id":"10",
    "content":"1群聊天",
    "attach":null,
    "type":1,
    "receiverId":"0b992b9a-8434-48c1-ad0a-135ddcd809e1",
    "receiverType":2
}
receiverId 分别对应人 和 群id
*/
public class MessageCreateModel {
    // ID从客户端生产，一个UUID
    @Expose
    @NotBlank(message = "消息id不能为空")
    private String id;

    @Expose
    @NotEmpty(message = "消息内容不能为空")
    private String content;

    @Expose
    private String attach;


    @Expose
    @Max(4)
    @Min(1)
    private int type = Message.TYPE_STR;

    // 接收者 可为空
    @Expose
    @NotBlank(message = "接收者id不能为空")
    private String receiverId;

    // 接收者类型，群，人
    @Expose
    @Max(2)
    @Min(1)
    private int receiverType = Message.RECEIVER_TYPE_NONE;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getAttach() {
        return attach;
    }

    public void setAttach(String attach) {
        this.attach = attach;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getReceiverId() {
        return receiverId;
    }

    public void setReceiverId(String receiverId) {
        this.receiverId = receiverId;
    }

    public int getReceiverType() {
        return receiverType;
    }

    public void setReceiverType(int receiverType) {
        this.receiverType = receiverType;
    }

    public static boolean check(MessageCreateModel model) {
        return true;
    }
}

